﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using XmlSockets.Internal;
using XmlSockets.Internal.AbSystem;

namespace LibXmlSocket_UnitTest
{
    class IOErrorSocket:IInternalSocket
    {
        bool errflag = true;

        public IEndPoint LocalEndPoint
        {
            get { throw new NotImplementedException(); }
        }

        public IEndPoint RemorteEndPoint
        {
            get { throw new NotImplementedException(); }
        }

        public async Task ConnectAsync(string hostName, int port)
        {
            await Task.Run(() => { });
        }

        public async Task<XmlSockets.Internal.IXmlSocketReceiveContent> ReceiveAsync(int size)
        {
            if (errflag) throw new IOException("単体テスト用IOException");
            return await Task.Run<IXmlSocketReceiveContent>(() =>
            {
                
                return default(IXmlSocketReceiveContent);
            });

            
        }

        public async Task SendAsync(XmlSockets.Internal.IXmlSocketSendContent content)
        {
            if(errflag)throw new IOException("単体テスト用IOException");
            await Task.Run(() =>
            {
                
                
            });
        }

        public void Dispose()
        {
            
        }
    }
}
